<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>购物车</title>
	<link href="${pageContext.request.contextPath}/client/css/main.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
</head>
<body>
	<%@include file="./include/head.jsp" %>
	<%@include file="./include/menu_search.jsp" %>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
	
	<div class="container" style="padding: 25px 0;">
		<div class="panel panel-default">
			<div class="panel-body">
				<div class="row">
					<div class="col-md-2">序号</div>
					<div class="col-md-2">商品名称</div>
					<div class="col-md-2">价格</div>
					<div class="col-md-2">库存</div>
					<div class="col-md-2">数量</div>
					<div class="col-md-2">删除</div>
				</div>
				<c:forEach items="${sessionScope.shoppingCart}" var="item" varStatus="status">
				<hr />
				<div class="row">
					<div class="col-md-2"><c:out value="${status.index + 1}" /></div>
					<div class="col-md-2"><c:out value="${item.name}" /></div>
					<div class="col-md-2"><c:out value="${item.price}" /></div>
					<div class="col-md-2"><c:out value="${item.pnum}" /></div>
					<div class="col-md-2"><c:out value="${item.select}" /></div>
					<div class="col-md-2">
						<a href="${pageContext.request.contextPath}/DeleteShoppingCartServlet?id=${item.id}" class="btn btn-danger">删除</a>
					</div>
				</div>
				</c:forEach>
			</div>
		</div>
		<c:if test="${sessionScope.shoppingCart.size() > 0 && sessionScope._username != null}">
			<div class="clearfix">
				<a href="${pageContext.request.contextPath}/PurchaseServlet?from=shoppingCart" class="btn btn-primary btn-lg pull-right">立即下单</a>
			</div>
		</c:if>
		<!--<c:if test="${sessionScope.shoppingCart.size() > 0 && sessionScope._username != null}">
			<div class="alert alert-info" role="alert">
				下单前请填写收货资料！
			</div>
			<form action="${pageContext.request.contextPath}/PurchaseServlet" method="POST" style="margin-bottom: 25px;">
				<div class="form-group">
					<label>收货人名称</label>
					<input type="text" name="receiverName" class="form-control" required>
				</div>
				<div class="form-group">
					<label>收货人地址</label>
					<input type="text" name="receiverAddress" class="form-control" required>
				</div>
				<div class="form-group">
					<label>收货人手机号</label>
					<input type="text" name="receiverPhone" class="form-control" required>
				</div>
				<button type="submit" class="btn btn-primary pull-right">提交订单</button>
			</form>
		</c:if>-->
	</div>
	
	<%@include file="./include/foot.jsp" %>
</body>
</html>